# Contributor: Markus Juenemann <markus@juenemann.net>
# Maintainer: Markus Juenemann <markus@juenemann.net>
pkgname=mapnik
pkgver=3.0.23
pkgrel=1
pkgdesc="An open source toolkit for developing mapping applications"
url="https://mapnik.org/"
arch="x86_64"
license="LPGL-2.0-or-later"
makedepends="
	boost-dev
	cairo-dev
	freetype-dev
	gdal-dev
	harfbuzz-dev
	icu-dev
	libpng-dev
	libwebp-dev
	libxml2-dev
	postgresql-dev
	proj-dev
	python3
	py3-setuptools
	sqlite-dev
	tiff-dev
	zlib-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/mapnik/mapnik/releases/download/v$pkgver/mapnik-v$pkgver.tar.bz2"

builddir="$srcdir/$pkgname-v$pkgver"
build() {
	python3 scons/scons.py configure \
		CUSTOM_CXXFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=ON" \
		CUSTOM_CFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=ON" \
		PREFIX=/usr \
		DESTDIR="$pkgdir" \
		--jobs=${JOBS:-2} \
		--config=cache \
		--implicit-cache \
		--max-drift=1
	python3 scons/scons.py \
		--jobs=${JOBS:-2} \
		--config=cache \
		--implicit-cache \
		--max-drift=1
}

package() {
	python3 scons/scons.py install \
		--jobs=${JOBS-2} \
		--config=cache \
		--implicit-cache \
		--max-drift=1
}

dev() {
	pkgdesc="Mapnik development files"
	mkdir -p "$subpkgdir"/usr/include/mapnik
	mv "$pkgdir"/usr/include/mapnik "$subpkgdir"/usr/include/mapnik
}

doc() {
	pkgdesc="Mapnik documentation"
	mkdir -p "$subpkgdir"/usr/share/docs/$pkgname/docs/
	install -Dm644 $builddir/*.md "$subpkgdir"/usr/share/docs/$pkgname/
	install -Dm644 $builddir/docs/* "$subpkgdir"/usr/share/docs/$pkgname/docs/
}

sha512sums="d901e092c8d876bc21f0e8cb713a6d102308983652f21f4fb5f120c50616724b692bcf0abe66ffecf1f0aa8a60e0f9b803be85eb0eee83c477895082559b38c9  mapnik-v3.0.23.tar.bz2"
